package academic.concordia.bankofquebec.bean.utils;

import java.util.Calendar;
import java.util.Date;

import academic.concordia.bankofquebec.entity.CreditCard;

public class CreditCardUtils {
	
	public static Date getExpirationDate(CreditCard creditCard){
		Date expirationDate = new Date();
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(expirationDate);
		calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR) 
								  + creditCard.getCardDescription().getExpirationYears());
		expirationDate = calendar.getTime();
		return expirationDate;
	}
	
	public static Date getPaymentDate(CreditCard creditCard){
		Date paymentDate = new Date();
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(paymentDate);
		calendar.set(Calendar.DAY_OF_MONTH, creditCard.getBillingCycle()
								  		  + 10);
		calendar.set(Calendar.HOUR, 0);
		calendar.set(Calendar.MINUTE, 0);
		calendar.set(Calendar.SECOND, 0);
		calendar.set(Calendar.MILLISECOND, 0);
		paymentDate = calendar.getTime();
		return paymentDate;
	}

}
